﻿package mortal.game.view.common.tooltip.tooltips
{
    import Message.DB.Tables.*;
    import __AS3__.vec.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.display.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.common.text.*;
    import mortal.common.tools.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.*;
    import mortal.game.view.common.tooltip.tooltips.base.*;
    import mortal.game.view.common.tooltip.tooltips.equipment.*;
    import mortal.game.view.common.util.*;
    import mortal.game.view.forging.data.*;
    import mortal.game.view.shopMall.view.*;

    public class ToolTipEquipment extends ToolTipScaleBg implements IToolTipComparableWithUpDownArrow
    {
        private var _txtName:GTextFiled;
        private var _icon:ShopSellItem;
        private var _bmpEquiped:Bitmap;
        private var _txtStrenLv:BitmapNumberText;
        private var _lockIcon:GBitmap;
        private var _txtBind:GTextFiled;
        private var _bmpZDL:GBitmap;
        private var _bmpFight:BitmapNumberText;
        private var _bmpUpDown:GBitmap;
        private var _txtSuitType:GTextFiled;
        private var _txtLevel:GTextFiled;
        private var _txtCareer:GTextFiled;
        private var _txtStarLabel:GTextFiled;
        private var _starPanel:StarPanel;
        private var _txtBasic:GTextFiled;
        private var _txtBasic2:GTextFiled;
        private var _txtStarAddLabel:GTextFiled;
        private var _txtBasicLeft:AutoLayoutTextContainer;
        private var _txtBasicRight:AutoLayoutTextContainer;
        private var _txtStarAdd:AutoLayoutTextContainer;
        private var _lineBasic:ScaleBitmap;
        private var _txtXilian:GTextFiled;
        private var _txtXilian2:GTextFiled;
        private var _txtXilianLeft:AutoLayoutTextContainer;
        private var _txtXilianRight:AutoLayoutTextContainer;
        private var _lineXilian:ScaleBitmap;
        private var _baoshiContainer:GSprite;
        private var _txtBaoShi:GTextFiled;
        private var _txtBaoShi2:GTextFiled;
        private var _lineBaoShi:ScaleBitmap;
        private var _stones:Array;
        private var _suitContainer:GSprite;
        private var _txtSuit:GTextFiled;
        private var _txtSuitName:GTextFiled;
        private var _suits:Array;
        private var _suitAdds:Array;
        private var _lineSuit:ScaleBitmap;
        private var _equipSkillContainer:GSprite;
        private var _txtEquipSkillName:GTextFiled;
        private var _txtEquipSkillActived:GTextFiled;
        private var _txtEquipSkillGet:GTextFiled;
        private var _lineEquipSkill:ScaleBitmap;
        private var _txtDesc:GTextFiled;
        protected var _txtTips:GTextFiled;
        private var _expiredTimeTxt:GTextFiled;
        private var _expiredTime:GTextFiled;
        private var _data:ItemData;
        private var _info:ItemEquipInfo;
        private var _equipedData:ItemData;
        private var _useItemExInfo:ItemExInfo;
        private var _strenLv:int;
        private var _stoneNum:int = 0;

        public function ToolTipEquipment()
        {
            this.createChildren();
            paddingBottom = 8;
            paddingLeft = 12;
            paddingRight = 8;
            paddingTop = 8;
            return;
        }// end function

        public function getMyCombat() : int
        {
            return parseInt(this._bmpFight.text);
        }// end function

        public function updateCombatUpDown(param1:int) : void
        {
            var _loc_2:* = parseInt(this._bmpFight.text);
            this._bmpUpDown.visible = true;
            if (_loc_2 > param1)
            {
                this._bmpUpDown.bitmapData = GlobalClass.getBitmapData(ImagesConst.ToolTipUpArrow);
            }
            else if (_loc_2 == param1)
            {
                this._bmpUpDown.visible = false;
            }
            else
            {
                this._bmpUpDown.bitmapData = GlobalClass.getBitmapData(ImagesConst.ToolTipDownArrow);
            }
            return;
        }// end function

        public function setEquipedData(param1:Object) : void
        {
            this._equipedData = param1 as ItemData;
            return;
        }// end function

        public function set equiped(param1:Boolean) : void
        {
            if (param1)
            {
                if (this._bmpEquiped == null)
                {
                    this._bmpEquiped = UIFactory.bitmap(ImagesConst.EquipedLabel, -10, 18);
                }
                contentContainer2D.addChild(this._bmpEquiped);
            }
            else
            {
                DisplayUtil.removeMe(this._bmpEquiped);
            }
            return;
        }// end function

        override public function set data(param1) : void
        {
            var _loc_4:ItemData = null;
            this._data = param1 as ItemData;
            if (this._data == null)
            {
                return;
            }
            super.data = this._data;
            this._info = this._data.itemInfo as ItemEquipInfo;
            var _loc_2:Boolean = false;
            if (this._data.serverData != null && this._data.serverData.playerId > 0 && this._data.serverData.playerId != Cache.instance.role.entityInfo.entityId.id)
            {
                this._equipedData = null;
                _loc_2 = true;
            }
            this.updateStrenLv();
            setBg(ToolTipUtil.getBgNameByColor(this._info.color));
            this.updateTopPart();
            this.updateStar();
            this.updateBasicAttr();
            if (this._data.itemInfo.type > 12)
            {
                this._txtBaoShi2.text = "";
            }
            else
            {
                this._txtBaoShi2.htmlText = Language.getStringByParam(20216, EquipmentUtil.getStoneTypeName(this._data));
            }
            if (!_loc_2)
            {
                if (Cache.instance.role.entityInfo.level >= GameConst.GemOpenLevel && Cache.instance.forging.getGemDataByEquipType(this._data.itemInfo.type) != null)
                {
                    this._txtBaoShi.visible = true;
                    this._txtBaoShi2.visible = true;
                    this._lineBaoShi.visible = true;
                }
                else
                {
                    this._txtBaoShi.visible = false;
                    this._txtBaoShi2.visible = false;
                    this._lineBaoShi.visible = false;
                }
            }
            else if (this._data.extData is Array)
            {
                this._txtBaoShi.visible = true;
                this._txtBaoShi2.visible = true;
                this._lineBaoShi.visible = true;
            }
            else
            {
                this._txtBaoShi.visible = false;
                this._txtBaoShi2.visible = false;
                this._lineBaoShi.visible = false;
            }
            var _loc_3:* = !_loc_2 && this._equipedData != null && this._equipedData.extInfo != null;
            if ((this._data.extInfo != null || _loc_3) && EquipmentUtil.isCanRefresh(this._data))
            {
                _loc_4 = this._data;
                if (_loc_3)
                {
                    _loc_4 = this._equipedData;
                }
                this.updateXiLianAtrr(_loc_4);
                this._txtXilian2.text = Language.getString(20215);
                if (this._txtXilianLeft.parent == null)
                {
                    contentContainer2D.addChild(this._txtXilianLeft);
                }
                if (this._txtXilianRight.parent == null)
                {
                    contentContainer2D.addChild(this._txtXilianRight);
                }
            }
            else
            {
                DisplayUtil.removeMe(this._txtXilianLeft);
                DisplayUtil.removeMe(this._txtXilianRight);
                DisplayUtil.removeMe(this._baoshiContainer);
                this._txtXilian2.text = "（" + Language.getString(20220) + "）";
            }
            if (this._txtBaoShi.visible)
            {
                this.updateStonesAttr(_loc_2);
                if (this._baoshiContainer.parent == null)
                {
                    contentContainer2D.addChild(this._baoshiContainer);
                }
            }
            else
            {
                DisplayUtil.removeMe(this._baoshiContainer);
            }
            if (!EquipmentUtil.isCanRefresh(this._data))
            {
                this._txtXilian.visible = false;
                this._txtXilian2.visible = false;
                this._lineXilian.visible = false;
            }
            else
            {
                this._txtXilian.visible = true;
                this._txtXilian2.visible = true;
                this._lineXilian.visible = true;
            }
            this.updateSuitAttr();
            this.updateEquipSkillAttr();
            this.updateLayout();
            _scaleBg.setSize(270, paddingTop + paddingBottom + this._txtTips.y + 20);
            this.updateName();
            this.updateExpiredTime();
            return;
        }// end function

        public function setBuyback(param1:int) : void
        {
            var _loc_2:String = null;
            var _loc_3:Boolean = false;
            if (this._data.serverData.uid)
            {
                if (param1 < 0)
                {
                    this._txtTips.text = Language.getString(20248);
                    this._txtTips.textColor = 3602685;
                }
                else
                {
                    _loc_2 = GameDefConfig.instance.getEPrictUnitName(this._data.itemInfo.sellUnit);
                    _loc_3 = Cache.instance.role.enoughMoney(this._data.itemInfo.sellUnit, param1);
                    if (!_loc_3)
                    {
                        this._txtTips.textColor = 16711680;
                    }
                    else
                    {
                        this._txtTips.textColor = 65280;
                    }
                    this._txtTips.text = Language.getStringByParam(20260, param1.toString() + _loc_2);
                }
            }
            else
            {
                this._txtTips.text = "";
            }
            _scaleBg.setSize(270, paddingTop + paddingBottom + this._txtTips.y + 20);
            return;
        }// end function

        override public function get width() : Number
        {
            return _scaleBg.width;
        }// end function

        override public function get height() : Number
        {
            return _scaleBg.height;
        }// end function

        private function updateStar() : void
        {
            if (this._info.qualityLimited == 0)
            {
                this._txtStarAdd.visible = false;
                this._txtStarLabel.visible = false;
                this._starPanel.visible = false;
                this._txtStarAddLabel.visible = false;
                return;
            }
            this._txtStarAdd.visible = true;
            this._txtStarLabel.visible = true;
            this._starPanel.visible = true;
            this._txtStarAddLabel.visible = true;
            var _loc_1:int = 0;
            if (this._data.extInfo != null)
            {
                _loc_1 = this._data.extInfo.qual;
            }
            if (_loc_1 > 0)
            {
                this._starPanel.setStarNum(this._info.qualityLimited, this._data.extInfo.qual);
            }
            else
            {
                this._starPanel.setStarNum(this._info.qualityLimited, 0);
            }
            return;
        }// end function

        private function updateTopPart() : void
        {
            var _loc_1:* = ItemsUtil.isBind(this._data);
            this._icon.itemData = this._data;
            this._icon.isBind = _loc_1;
            if (this._strenLv <= 0)
            {
                this._txtStrenLv.text = "";
            }
            else
            {
                this._txtStrenLv.text = "+" + this._strenLv.toString();
            }
            this._txtStrenLv.x = 69 - this._txtStrenLv.width;
            this._lockIcon.visible = _loc_1;
            if (_loc_1)
            {
                this._txtBind.textColor = GlobalStyle.colorHongUint;
                this._txtBind.text = Language.getString(20206);
                this._txtBind.x = 100;
            }
            else
            {
                this._txtBind.textColor = GlobalStyle.colorLvUint;
                this._txtBind.text = Language.getString(20205);
                this._txtBind.x = 79;
            }
            this._bmpFight.text = EquipmentUtil.getEquipCombat(this._data, 0, this._useItemExInfo).toString();
            this._bmpUpDown.x = this._bmpFight.x + this._bmpFight.width + 8;
            this._bmpUpDown.visible = false;
            var _loc_2:* = GameDefConfig.instance.getEquipName(this._info.type);
            if (this._info.suitGroup > 0)
            {
                _loc_2 = _loc_2 + Language.getString(20771);
            }
            this._txtSuitType.text = _loc_2;
            this._txtLevel.text = Language.getString(30011) + "：" + this._info.level.toString();
            this._txtCareer.text = GameDefConfig.instance.getCarrer(this._info.career);
            if (CareerUtil.isCareerSuit(this._info.career, Cache.instance.role.entityInfo.career))
            {
                this._txtCareer.textColor = 15911263;
            }
            else
            {
                this._txtCareer.textColor = 16711680;
            }
            if (this._info.alyDesc() != null)
            {
                this._txtDesc.height = 200;
                this._txtDesc.htmlText = this._info.alyDesc();
                this._txtDesc.height = this._txtDesc.textHeight + 8;
            }
            return;
        }// end function

        private function updateBasicAttr() : void
        {
            var _loc_1:AttributeData = null;
            var _loc_6:int = 0;
            var _loc_2:* = AttributeUtil.getEquipmentBasicAttrs(this._data.itemInfo as ItemEquipInfo, 0);
            var _loc_3:* = this._txtBasicLeft.numChildren;
            var _loc_4:* = _loc_2.length - _loc_3;
            if (_loc_4 > 0)
            {
                _loc_6 = 0;
                while (_loc_6 < _loc_4)
                {
                    
                    this._txtBasicLeft.addNewText(120);
                    this._txtBasicRight.addNewText(120, " ", 12, GlobalStyle.colorLvUint);
                    this._txtStarAdd.addNewText(120, " ", 12, GlobalStyle.colorLvUint);
                    _loc_6++;
                }
            }
            else if (_loc_4 < 0)
            {
                this._txtBasicLeft.split(_loc_2.length);
                this._txtBasicRight.split(_loc_2.length);
                this._txtStarAdd.split(_loc_2.length);
            }
            _loc_6 = 0;
            while (_loc_6 < _loc_2.length)
            {
                
                _loc_1 = _loc_2[_loc_6];
                this._txtBasicLeft.setText(_loc_6, _loc_1.name + " : " + _loc_1.value);
                _loc_6++;
            }
            if (this._data.addPercent > 0)
            {
                if (_loc_2.length > 0)
                {
                    if (this._txtStarAdd.parent == null)
                    {
                        this.addChild(this._txtStarAdd);
                    }
                }
                _loc_6 = 0;
                while (_loc_6 < _loc_2.length)
                {
                    
                    _loc_1 = _loc_2[_loc_6];
                    this._txtStarAdd.setText(_loc_6, "(+" + int(_loc_1.value * this._data.addPercent).toString() + ")");
                    _loc_6++;
                }
            }
            else
            {
                DisplayUtil.removeMe(this._txtStarAdd);
            }
            var _loc_5:* = EquipmentUtil.getStrengthenAttr(this._data, false, this._useItemExInfo);
            if (_loc_5.length > 0)
            {
                if (this._txtBasicRight.parent == null)
                {
                    this.addChild(this._txtBasicRight);
                }
                _loc_6 = 0;
                while (_loc_6 < _loc_5.length)
                {
                    
                    _loc_1 = _loc_5[_loc_6];
                    if (_loc_1.value > 0)
                    {
                        this._txtBasicRight.setText(_loc_6, "(+" + _loc_1.value.toString() + ")");
                    }
                    else
                    {
                        this._txtBasicRight.setText(_loc_6, " ");
                    }
                    _loc_6++;
                }
            }
            else
            {
                DisplayUtil.removeMe(this._txtBasicRight);
            }
            return;
        }// end function

        private function updateXiLianAtrr(param1:ItemData) : void
        {
            var _loc_5:AttributeData = null;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:uint = 0;
            var _loc_9:GTextFiled = null;
            var _loc_10:GTextFiled = null;
            var _loc_11:String = null;
            var _loc_2:* = EquipmentUtil.getEquipmentXiLianAttrs(param1, this._useItemExInfo);
            var _loc_3:* = _loc_2.length;
            this._txtXilianLeft.split(_loc_3);
            this._txtXilianRight.split(_loc_3);
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3)
            {
                
                if (this._txtXilianLeft.getTextByIndex(_loc_4) == null)
                {
                    this._txtXilianLeft.addNewText(220, "", 12, GlobalStyle.colorLanUint);
                }
                if (this._txtXilianRight.getTextByIndex(_loc_4) == null)
                {
                    this._txtXilianRight.addNewText(220, "", 12, GlobalStyle.colorLanUint);
                }
                _loc_5 = _loc_2[_loc_4];
                _loc_6 = parseInt(_loc_5.attrName);
                _loc_7 = EquipRefreshConfig.instance.getMaxStarLevel(param1.itemInfo.level);
                _loc_8 = ForgingUtil.instance.getPropColor(_loc_6, _loc_7);
                this._txtXilianLeft.setText(_loc_4, " ");
                this._txtXilianRight.setText(_loc_4, " ");
                _loc_9 = this._txtXilianLeft.getTextByIndex(_loc_4);
                _loc_10 = this._txtXilianRight.getTextByIndex(_loc_4);
                _loc_9.textColor = _loc_8;
                _loc_10.textColor = _loc_8;
                _loc_9.text = _loc_5.name + " +" + (_loc_5.value - _loc_5.baseValue);
                _loc_11 = Language.getStringByParam(20772, _loc_6);
                if (_loc_5.baseValue > 0)
                {
                    _loc_11 = _loc_11 + ("+" + _loc_5.baseValue);
                }
                _loc_10.text = _loc_11;
                _loc_4++;
            }
            return;
        }// end function

        private function updateStonesAttr(param1:Boolean = false) : void
        {
            var _loc_5:ToolTipStoneData = null;
            var _loc_6:ToolTipStoneItem = null;
            var _loc_2:* = this._data;
            if (this._equipedData != null)
            {
                _loc_2 = this._equipedData;
            }
            var _loc_3:Array = [];
            if (param1)
            {
                if (this._data.extData is Array)
                {
                    _loc_3 = EquipmentUtil.getEquipmentStonesData2(_loc_2, this._data.extData);
                }
            }
            else
            {
                _loc_3 = EquipmentUtil.getEquipmentStonesData2(_loc_2);
            }
            this._stoneNum = _loc_3.length;
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = _loc_3[_loc_4];
                _loc_6 = this._stones[_loc_4];
                _loc_6.stoneData = _loc_5;
                if (_loc_6.parent == null)
                {
                    this._baoshiContainer.addChild(_loc_6);
                }
                _loc_4++;
            }
            _loc_4 = this._stoneNum;
            while (_loc_4 < this._stones.length)
            {
                
                _loc_6 = this._stones[_loc_4];
                DisplayUtil.removeMe(_loc_6);
                _loc_4++;
            }
            if (Cache.instance.role.entityInfo.level >= 90)
            {
                this._baoshiContainer.addChild(this._stones[(this._stones.length - 1)]);
                this._baoshiContainer.addChild(this._stones[this._stones.length - 2]);
            }
            else
            {
                DisplayUtil.removeMe(this._stones[(this._stones.length - 1)]);
                DisplayUtil.removeMe(this._stones[this._stones.length - 2]);
            }
            return;
        }// end function

        private function updateEquipSkillAttr() : void
        {
            var _loc_1:* = (this._data.itemInfo as ItemEquipInfo).suitId;
            var _loc_2:* = ItemConfig.instance.getSuitById(_loc_1);
            if (_loc_2 == null || _loc_2.skill == null || _loc_2.skill.length < 2)
            {
                this.disposeEquipSkill();
                return;
            }
            var _loc_3:* = SkillConfig.instance.getInfoById(parseInt(_loc_2.skill));
            if (_loc_3 == null)
            {
                this.disposeEquipSkill();
                return;
            }
            if (this._equipSkillContainer == null)
            {
                this._equipSkillContainer = UICompomentPool.getUICompoment(GSprite) as GSprite;
                this.addChild(this._equipSkillContainer);
            }
            var _loc_4:* = GlobalStyle.textFormatPutong;
            _loc_4.size = 12;
            if (this._txtEquipSkillName == null)
            {
                this._txtEquipSkillName = UIFactory.gTextField("", 0, 0, 230, 22, this._equipSkillContainer, _loc_4);
            }
            if (this._txtEquipSkillActived == null)
            {
                this._txtEquipSkillActived = UIFactory.gTextField("", 172, 0, 79, 22, this._equipSkillContainer, _loc_4.clone());
            }
            if (this._txtEquipSkillGet == null)
            {
                _loc_4 = _loc_4.clone();
                this._txtEquipSkillGet = UIFactory.gTextField("", 0, 21, 236, 40, this._equipSkillContainer, _loc_4);
                this._txtEquipSkillGet.multiline = true;
                this._txtEquipSkillGet.wordWrap = true;
            }
            if (this._lineEquipSkill == null)
            {
                this._lineEquipSkill = UIFactory.bg(0, 46, 256, 2, this._equipSkillContainer, ImagesConst.SplitLine);
            }
            var _loc_5:* = Cache.instance.skill.getSkillBySerialId(_loc_3.series) != null;
            var _loc_6:* = _loc_5 ? ("#00ff00") : ("#ff0000");
            var _loc_7:* = _loc_5 ? (Language.getString(20773)) : (Language.getString(20774));
            this._txtEquipSkillName.htmlText = Language.getStringByParam(20775, _loc_6, _loc_3.name);
            this._txtEquipSkillActived.htmlText = "<font color=\'" + _loc_6 + "\'>" + _loc_7 + "</font>";
            var _loc_8:* = DescConfig.instance.getDescById(_loc_3.needExperience);
            this._txtEquipSkillGet.height = 80;
            this._txtEquipSkillGet.htmlText = _loc_8;
            this._txtEquipSkillGet.height = this._txtEquipSkillGet.textHeight + 4;
            return;
        }// end function

        private function disposeEquipSkill() : void
        {
            if (this._equipSkillContainer != null)
            {
                this._equipSkillContainer.dispose(true);
                this._equipSkillContainer = null;
            }
            if (this._txtEquipSkillActived != null)
            {
                this._txtEquipSkillActived.dispose(true);
                this._txtEquipSkillActived = null;
            }
            if (this._txtEquipSkillGet != null)
            {
                this._txtEquipSkillGet.dispose(true);
                this._txtEquipSkillGet = null;
            }
            if (this._txtEquipSkillName != null)
            {
                this._txtEquipSkillName.dispose(true);
                this._txtEquipSkillName = null;
            }
            if (this._lineEquipSkill != null)
            {
                this._lineEquipSkill.dispose(true);
                this._lineEquipSkill = null;
            }
            return;
        }// end function

        private function updateSuitAttr() : void
        {
            var _loc_4:GTextFiled = null;
            var _loc_5:AttributeData = null;
            var _loc_6:AttributeData = null;
            var _loc_1:* = EquipmentUtil.getEquipmentSuitData((this._data.itemInfo as ItemEquipInfo).suitId, this._data.itemInfo.career, this._data.itemInfo.color);
            if (_loc_1 == null)
            {
                DisplayUtil.removeMe(this._suitContainer);
                return;
            }
            if (this._suitContainer.parent == null)
            {
                this.addChild(this._suitContainer);
            }
            var _loc_2:* = ColorConfig.instance.getItemColor(_loc_1.color);
            this._txtSuitName.htmlText = HTMLUtil.addColor(_loc_1.name, _loc_2.color);
            var _loc_3:int = 0;
            while (_loc_3 < this._suits.length)
            {
                
                _loc_4 = this._suits[_loc_3];
                if (_loc_3 < _loc_1.parts.length)
                {
                    _loc_5 = _loc_1.parts[_loc_3] as AttributeData;
                    _loc_4.htmlText = HTMLUtil.addColor(_loc_5.name, _loc_2.color);
                    if (_loc_5.type == 1)
                    {
                        _loc_4.filters = [];
                    }
                    else
                    {
                        _loc_4.filters = [FilterConst.colorFilter];
                    }
                }
                else
                {
                    _loc_4.htmlText = "";
                }
                _loc_3++;
            }
            _loc_3 = 0;
            while (_loc_3 < this._suitAdds.length)
            {
                
                _loc_4 = this._suitAdds[_loc_3] as GTextFiled;
                if (_loc_3 < _loc_1.attrs.length)
                {
                    _loc_6 = _loc_1.attrs[_loc_3] as AttributeData;
                    _loc_4.text = _loc_6.name;
                    if (_loc_6.type == 1)
                    {
                        _loc_4.filters = [];
                    }
                    else
                    {
                        _loc_4.filters = [FilterConst.colorFilter];
                    }
                }
                else
                {
                    _loc_4.htmlText = "";
                }
                _loc_3++;
            }
            this.updateSuitsLayout(!EquipmentUtil.isEquipFashion(this._data));
            return;
        }// end function

        public function updateSuitsLayout(param1:Boolean = true) : void
        {
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_6:GTextFiled = null;
            var _loc_4:int = 4;
            var _loc_5:int = 41;
            if (!param1)
            {
                _loc_4 = 2;
                _loc_5 = 81;
            }
            _loc_2 = 0;
            while (_loc_2 < 8)
            {
                
                _loc_3 = _loc_2 % _loc_4;
                _loc_6 = this._suits[_loc_2];
                _loc_6.x = this._txtSuit.x + 24 + _loc_3 * _loc_5;
                _loc_6.y = this._txtSuit.y + 17 * int(_loc_2 / _loc_4) + 17;
                _loc_2++;
            }
            return;
        }// end function

        private function updateName() : void
        {
            this._txtName.width = _scaleBg.width;
            this._txtName.htmlText = ItemsUtil.getItemWholeName(this._data, true, 0, false, this._strenLv);
            this._txtName.x = -6;
            return;
        }// end function

        private function updateExpiredTime() : void
        {
            var _loc_1:Date = null;
            this._expiredTime.text = "";
            this._expiredTimeTxt.text = "";
            if (this._data.extInfo && this._data.extInfo.fashionEffDay)
            {
                if (DateParser.strToDateNormal(this._data.extInfo.fashionEffDay).fullYear != 2000)
                {
                    _loc_1 = DateParser.strToDateNormal(this._data.extInfo.fashionEffDay);
                    this._expiredTimeTxt.text = Language.getString(20776);
                    this._expiredTime.text = DateParser.parse(_loc_1, "MM-dd hh:mm");
                }
            }
            else if (this._data.itemInfo.endDate.fullYear != 2000)
            {
                this._expiredTimeTxt.text = Language.getString(20776);
                this._expiredTime.text = DateParser.parse(this._data.itemInfo.endDate, "MM-dd hh:mm");
            }
            return;
        }// end function

        private function createChildren() : void
        {
            var _loc_3:ToolTipStoneItem = null;
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = TextFormatAlign.CENTER;
            _loc_1.size = 14;
            _loc_1.bold = true;
            this._txtName = UIFactory.gTextField("", -6, 0, 220, 25, this, _loc_1);
            this._icon = UICompomentPool.getUICompoment(ShopSellItem);
            this._icon.x = 0;
            this._icon.y = 26;
            this._icon.setItemStyle(ItemStyleConst.Big, ImagesConst.ShopItemBg, 6, 6);
            this._icon.createDisposedChildren();
            this.addChild(this._icon);
            this._icon.isShowLock = false;
            this._icon.isShowArroundEffect = false;
            _loc_1 = GlobalStyle.embedNumberTf;
            _loc_1.color = GlobalStyle.colorHuangUint;
            _loc_1.align = TextFormatAlign.RIGHT;
            this._txtStrenLv = UIFactory.bitmapNumberText(this._icon.x, this._icon.y + 50, "FightInfoNum.png", 12, 15, -1, this);
            this._lockIcon = UIFactory.bitmap(ImagesConst.LockIcon, 81, 34, contentContainer2D);
            this._txtBind = UIFactory.gTextField("", 100, 30, 100, 20, contentContainer2D);
            this._bmpZDL = UIFactory.gBitmap(ImagesConst.ToolTipCombat, 79, 78, contentContainer2D);
            this._bmpFight = UIFactory.bitmapNumberText(127, 78, "EquipToolTipCombat.png", 14, 16, -2, contentContainer2D, 10);
            this._bmpUpDown = UIFactory.gBitmap(null, 0, 78, contentContainer2D);
            this._txtSuitType = UIFactory.gTextField("", 155, 30, 100, 20, contentContainer2D);
            this._txtLevel = UIFactory.gTextField("", 155, 52, 100, 20, contentContainer2D);
            this._txtCareer = UIFactory.gTextField("", 79, 52, 100, 20, contentContainer2D);
            this._txtCareer.textColor = 15911263;
            this._txtStarLabel = UIFactory.gTextField(Language.getString(20700), 0, 114, 100, 20, contentContainer2D);
            this._txtStarLabel.textColor = GlobalStyle.colorChenUint;
            this._starPanel = UIFactory.getUICompoment(StarPanel, 25, 136, contentContainer2D);
            this._starPanel.setStarStyle(ImagesConst.star, ImagesConst.star_gray, 21);
            this._txtBasic = UIFactory.gTextField(Language.getString(20210), 0, 114, 100, 20, contentContainer2D);
            this._txtBasic.textColor = GlobalStyle.colorChenUint;
            this._txtBasic2 = UIFactory.gTextField(Language.getString(20214), 70, 114, 160, 20, contentContainer2D);
            this._txtBasic2.textColor = GlobalStyle.colorChenUint;
            this._txtStarAddLabel = UIFactory.gTextField(Language.getString(20702), 170, 114, 160, 20, contentContainer2D);
            this._txtStarAddLabel.textColor = GlobalStyle.colorChenUint;
            this._txtBasicLeft = new AutoLayoutTextContainer();
            this._txtBasicLeft.x = this._txtBasic.x;
            this._txtBasicLeft.y = this._txtBasic.y + 22;
            this._txtBasicLeft.verticalGap = -7;
            this.addChild(this._txtBasicLeft);
            this._txtBasicRight = new AutoLayoutTextContainer();
            this._txtBasicRight.x = this._txtBasic2.x + 23;
            this._txtBasicRight.y = this._txtBasicLeft.y;
            this._txtBasicRight.verticalGap = -7;
            this.addChild(this._txtBasicRight);
            this._txtStarAdd = new AutoLayoutTextContainer();
            this._txtStarAdd.x = this._txtStarAddLabel.x + 23;
            this._txtStarAdd.y = this._txtBasicLeft.y;
            this._txtStarAdd.verticalGap = -7;
            this.addChild(this._txtStarAdd);
            this._lineBasic = UIFactory.bg(0, 186, 256, 2, contentContainer2D, ImagesConst.SplitLine);
            this._txtXilian = UIFactory.gTextField(Language.getString(20211), 0, 194, 100, 20, contentContainer2D);
            this._txtXilian.textColor = GlobalStyle.colorChenUint;
            this._txtXilian2 = UIFactory.gTextField(Language.getString(20215), 70, 194, 160, 20, contentContainer2D);
            this._txtXilianLeft = new AutoLayoutTextContainer();
            this._txtXilianLeft.x = this._txtXilian.x;
            this._txtXilianLeft.y = this._txtXilian.y + 22;
            this._txtXilianLeft.verticalGap = -7;
            contentContainer2D.addChild(this._txtXilianLeft);
            this._txtXilianRight = new AutoLayoutTextContainer();
            this._txtXilianRight.x = this._txtXilian2.x + 6;
            this._txtXilianRight.y = this._txtXilianLeft.y;
            this._txtXilianRight.verticalGap = -7;
            contentContainer2D.addChild(this._txtXilianRight);
            this._lineXilian = UIFactory.bg(0, 264, 256, 2, contentContainer2D, ImagesConst.SplitLine);
            this._txtBaoShi = UIFactory.gTextField(Language.getString(20212), 0, 271, 100, 20, contentContainer2D);
            this._txtBaoShi.textColor = GlobalStyle.colorChenUint;
            this._txtBaoShi2 = UIFactory.gTextField("", 70, 271, 160, 20, contentContainer2D);
            this._baoshiContainer = UICompomentPool.getUICompoment(GSprite);
            contentContainer2D.addChild(this._baoshiContainer);
            this._stones = [];
            var _loc_2:int = 0;
            while (_loc_2 < 6)
            {
                
                _loc_3 = new ToolTipStoneItem();
                this._baoshiContainer.addChild(_loc_3);
                this._stones.push(_loc_3);
                if (_loc_2 % 2 == 0)
                {
                    _loc_3.x = this._txtBaoShi.x;
                }
                else
                {
                    _loc_3.x = this._txtBaoShi.x + 121;
                }
                _loc_3.y = int(_loc_2 / 2) * 33;
                _loc_2++;
            }
            this._lineBaoShi = UIFactory.bg(0, 391, 256, 2, contentContainer2D, ImagesConst.SplitLine);
            this._suitContainer = UICompomentPool.getUICompoment(GSprite);
            contentContainer2D.addChild(this._suitContainer);
            this._txtSuit = UIFactory.gTextField(Language.getString(20213), 0, 0, 100, 20, this._suitContainer);
            this._txtSuit.textColor = GlobalStyle.colorChenUint;
            this._txtSuitName = UIFactory.gTextField("", 79, 0, 160, 20, this._suitContainer);
            this._suits = [];
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 17, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 65, this._txtSuit.y + 17, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 106, this._txtSuit.y + 17, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 147, this._txtSuit.y + 17, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 34, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 65, this._txtSuit.y + 34, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 106, this._txtSuit.y + 34, 120, 20, this._suitContainer));
            this._suits.push(UIFactory.gTextField("", this._txtSuit.x + 147, this._txtSuit.y + 34, 120, 20, this._suitContainer));
            this._suitAdds = [];
            this._suitAdds.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 51, 230, 20, this._suitContainer, GlobalStyle.textFormatLv));
            this._suitAdds.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 68, 230, 20, this._suitContainer, GlobalStyle.textFormatLv));
            this._suitAdds.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 85, 230, 20, this._suitContainer, GlobalStyle.textFormatLv));
            this._suitAdds.push(UIFactory.gTextField("", this._txtSuit.x + 24, this._txtSuit.y + 102, 230, 20, this._suitContainer, GlobalStyle.textFormatLv));
            this._lineSuit = UIFactory.bg(0, 125, 256, 2, this._suitContainer, ImagesConst.SplitLine);
            this._expiredTimeTxt = UIFactory.gTextField("", 0, 415, 120, 20, contentContainer2D);
            this._expiredTime = UIFactory.gTextField("", 60, 415, 123, 20, contentContainer2D);
            this._txtDesc = UIFactory.gTextField("", 0, this._lineSuit.y + 4, 232, 120);
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            this._txtTips = UIFactory.gTextField(Language.getString(20248), 0, this._txtDesc.y + 60, 242, 20, contentContainer2D);
            this._txtTips.textColor = 3602685;
            return;
        }// end function

        private function updateLayout() : void
        {
            var _loc_1:* = this._starPanel.y + 22;
            if (this._starPanel.visible == false)
            {
                _loc_1 = 114;
            }
            var _loc_2:* = _loc_1;
            this._txtStarAddLabel.y = _loc_1;
            var _loc_2:* = _loc_2;
            this._txtBasic2.y = _loc_2;
            this._txtBasic.y = _loc_2;
            _loc_1 = _loc_1 + 22;
            var _loc_2:* = _loc_1;
            this._txtStarAdd.y = _loc_1;
            var _loc_2:* = _loc_2;
            this._txtBasicRight.y = _loc_2;
            this._txtBasicLeft.y = _loc_2;
            _loc_1 = _loc_1 + this._txtBasicLeft.height;
            this._lineBasic.y = _loc_1;
            if (this._txtXilian.visible)
            {
                _loc_1 = _loc_1 + 4;
                var _loc_2:* = _loc_1;
                this._txtXilian2.y = _loc_1;
                this._txtXilian.y = _loc_2;
                _loc_1 = _loc_1 + 24;
                this._txtXilianLeft.y = _loc_1;
                this._txtXilianRight.y = _loc_1;
                if (this._txtXilianLeft.numChildren >= 1 && this._txtXilianLeft.parent != null)
                {
                    this._lineXilian.y = this._txtXilianLeft.y + this._txtXilianLeft.numChildren * 18 - 3;
                }
                else
                {
                    this._lineXilian.y = this._txtXilianLeft.y + 2;
                }
                _loc_1 = this._lineXilian.y;
            }
            _loc_1 = _loc_1 + 5;
            if (this._txtBaoShi.visible)
            {
                var _loc_2:* = _loc_1;
                this._txtBaoShi2.y = _loc_1;
                this._txtBaoShi.y = _loc_2;
                _loc_1 = _loc_1 + 22;
                this._baoshiContainer.y = _loc_1;
                if (this._baoshiContainer.parent != null)
                {
                    this._lineBaoShi.y = this._baoshiContainer.y + this._baoshiContainer.height + 4;
                }
                else
                {
                    this._lineBaoShi.y = this._txtBaoShi.y + 23;
                }
                _loc_1 = this._lineBaoShi.y + 4;
            }
            this._suitContainer.y = _loc_1;
            if (this._suitContainer.parent != null)
            {
                _loc_1 = _loc_1 + 128;
            }
            if (this._equipSkillContainer != null)
            {
                this._equipSkillContainer.y = _loc_1;
                _loc_1 = _loc_1 + 54;
            }
            this._txtDesc.y = _loc_1;
            this._txtTips.y = this._txtDesc.y + this._txtDesc.textHeight + 4;
            return;
        }// end function

        private function updateStrenLv() : void
        {
            if (this._data.extData != null && this._data.extData is ItemExInfo)
            {
                this._useItemExInfo = this._data.extData as ItemExInfo;
                this._strenLv = (this._data.extData as ItemExInfo).strengthen;
                return;
            }
            var _loc_1:* = this._data;
            if (this._equipedData != null)
            {
                _loc_1 = this._equipedData;
            }
            this._useItemExInfo = _loc_1.extInfo;
            if (_loc_1.extInfo != null && _loc_1.extInfo.strengthen >= 0)
            {
                if (_loc_1.extInfo.strengthen == 0 && _loc_1.extInfo.currentStrengthen == 0)
                {
                    this._strenLv = 0;
                }
                else
                {
                    this._strenLv = _loc_1.extInfo.strengthen;
                }
            }
            else
            {
                this._strenLv = 0;
            }
            return;
        }// end function

    }
}
